package com.hdu.asyncInitBean;

import com.hdu.async_initialize_bean.annotation.EnableAsyncInit;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

import java.util.concurrent.ThreadPoolExecutor;

@SpringBootApplication
@EnableAsyncInit
public class Application {
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

    @Bean
    public ThreadPoolExecutor myThreadPoolExecutor() {
        return new ThreadPoolExecutor(
                1,
                1,
                0L,
                java.util.concurrent.TimeUnit.MILLISECONDS,
                new java.util.concurrent.LinkedBlockingQueue<Runnable>()
        );
    }
}
